<template>
  <div class="login_box">
    <el-form
      label-position="right"
      label-width="60px"
      :model="loginform"
    >
      <el-form-item label="用户名">
        <el-input v-model="loginform.username"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input
          type="password"
          v-model="loginform.pew"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          @click="submituUserInfo"
        >登录</el-button>
      </el-form-item>
    </el-form>
  </div>

</template>

<script>
export default {
  name: "login",
  data() {
    return {
      loginform: {
        username: "admin",
        pew: "123456"
      }
    };
  },
  methods: {
    submituUserInfo() {
      this.$store.dispatch("Logins", this.loginform).then(res => {
        /* 追加一条记录到路由栈内  跳转界面*/
        this.$router.push("/");
      });
    }
  }
};
</script>

<style scoped>
.login_box {
  width: 280px;
  position: fixed;
  left: 39%;
  top: 200px;
  border: 1px solid skyblue;
  border-radius: 15px;
  padding: 38px 60px 5px 25px;
  text-align: center;
}
</style>
